@(page: models.cms.PageDto)(block: models.cms.BlockDto)
@contents = @{(block.getData().get("contents")).asInstanceOf[List[models.core.catalog.VigneronDto]]}

<script type="text/javascript">
 $(document).ready( function(){	
 		
		$("#saisiecommentaire").TextAreaExpander(50,9999);

 
		$(".produit").hover(
		  function () {
			$(this).find('.ajoutpanier').stop(true, true).fadeIn();
		  }, 
		  function () {
			$(this).find('.ajoutpanier').stop(true, true).fadeOut();
		  }
		); 
		
		
		var overlay = {
			show	: function(){
				$('body').append('<div id="overlay"></div>');
			},
			hide	: function(){
				$('#overlay').remove();
			}
		}		 
 
 
         $('.recommandations_click').click(function() {	
			 overlay.show();
			$('#lightboxmembrestop').fadeIn('slow');
			return false;
        });
		
		$('#fermerlightbox>a').click(function() {	
			$('#lightboxmembrestop').fadeOut('slow');
			 overlay.hide();
			return false;
        }); 
 

			$("#diaporama .boutondiapo").fancybox({
				'titlePosition'	: 'over',//over,inside
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'opacity'		: true
			});
		
		
						
			function init_raty(score_val){
				$('#val_raty_info').text('0.0');
				$('#etoilesnote').raty({
					half	: true,
					score	: score_val,
					click: function(score) {
						//alert('score: ' + score);
						$('#val_raty_info').text(score);
						$('#value_raty').val(score);
						if(score>=4){
							$('#bullenote').css({"backgroundImage":"url('@routes.Assets.at("images/bulle-commentaire-bleue.png")')"}); 
						} else {
							$('#bullenote').css({"backgroundImage":"url('@routes.Assets.at("images/bulle-commentaire.png")')"}); 
						}
					}
				});
			}
			
			init_raty(0);
			
			
			$('#bullenote').click(function() {	
				val_score_raty = $('#value_raty').val();
				if(val_score_raty==0){
					init_raty(5);
					$('#val_raty_info').text(5);
					$('#value_raty').val(5);
					$('#bullenote').css({"backgroundImage":"url('@routes.Assets.at("images/bulle-commentaire-bleue.png")')"}); 
				} else {
					init_raty(0);
					$('#val_raty_info').text(0);
					$('#value_raty').val(0);
					$('#bullenote').css({"backgroundImage":"url('@routes.Assets.at("images/bulle-commentaire.png")')"}); 
				}
				return false;
			});			
			
			
			
						
			$('#valideravis').click(function() {	
					alert('score: ' + $('#value_raty').val());
					return false;
			});			
			
		
			
				
				 
				
		// buttons for next and previous item						 
		var buttons = { previous:$('#diaporama .button-previous') ,next:$('#diaporama .button-next') };			
		 $('#diaporama').lofJSidernews( { interval : 2000,
			direction		: 'opacitys',	
			easing			: 'easeInOutExpo',
			duration		: 1200,
			auto		 	: false,
			maxItemDisplay  : 0,
			navPosition     : 'horizontal', // horizontal
			navigatorHeight : 32,
			navigatorWidth  : 80,
			mainWidth		: 1000,
			buttons			: buttons } );	
	});
</script> 


@for(vigneron <- contents){

<script type="text/javascript">
$(function() {  
	 $("#ajoutfavoris").click(function() {  
        var urlString = '@routes.User.addFavorite("vigneron",""+vigneron.getId())' ;   
  	    alert(urlString);
  	    $.ajax({  
  	      type: "POST",  
  	      url: urlString,  
  	      success: function(data) {  
  	        
  	      }  
  	    });  
  	    return false;  
    });  
  });
</script>
<div id="titrepage">
	<h2>@vigneron.getFirstName() @vigneron.getLastName()</h2>
	@for(domain <- vigneron.getDomains()){
		<h3>@domain.getName()</h3>
	}
	<a id="ajoutfavoris" title="Ajouter aux favoris" ></a> <a
		id="patarger" title="Partager" href="#"></a>
</div>
@if(vigneron.getContent().getMediasByType() != null && vigneron.getContent().getMediasByType().get("2") != null){
<div id="diaporama" class="diaporama">
	<div class="main-slider-content">
		<div class="sliders-wrapper" style="width: 1000px;">
			<ul class="sliders-wrap-inner" style="left: 0px; width: 6000px;">
				@for(media <- vigneron.getContent().getMediasByType().get("2")){
				<li style="width: 1000px;">
					<img width="1000" height="443" border="0" alt="" src="@routes.Assets.at(media.getUrl())">
					<a class="boutondiapo" title="Lancer le diaporama" href="@routes.Assets.at(media.getUrl())"></a>
					<div class="slider-description">@media.getDescription()</div>
				</li>
				}
			</ul>
		</div>
	</div>
	<div class="navigator-content">
		<div class="button-next"></div>
		<div class="button-previous"></div>
	</div>
</div>
}
<a name="details"></a> 
<div id="commentaire">
	@if(vigneron.getContent().getMediasByType() != null && vigneron.getContent().getMediasByType().get("1") != null){
	<img id="photovigneron" width="192" height="192"
		alt="@vigneron.getFirstName() @vigneron.getLastName()" src="@(routes.Assets.at(vigneron.getContent().getMediasByType().get("1").get(0).getUrl()))">
		
	} else {
	<img id="photovigneron" width="192" height="192"
		alt="@vigneron.getFirstName() @vigneron.getLastName()" src="@routes.Assets.at("upload/vignerons/vigneronsdefault-big.jpg")">
	}
	<div id="bloccommentaire">
		<form method="post" name="depotcommentaire" action="">
			<div id="etoilesnote" style="cursor: pointer; width: 180px;">
				<img src="@routes.Assets.at("images/star-off.png")" alt="1" title="mauvais"> 
				<img src="@routes.Assets.at("images/star-off.png")" alt="2" title="faible"> <img
					src="@routes.Assets.at("images/star-off.png")" alt="3" title="moyen"> <img
					src="@routes.Assets.at("images/star-off.png")" alt="4" title="bon"> <img
					src="@routes.Assets.at("images/star-off.png")" alt="5" title="excelent"> <input
					type="hidden" name="score">
			</div>
			<div id="bullenote">
				note <br> &gt; <span id="val_raty_info">@vigneron.getScore()</span>
			</div>
			<input id="value_raty" type="hidden" value="0" name="value_raty">
			<input id="valideravis" type="image" alt="valider votre avis"
				name="valideravis" src="@routes.Assets.at("images/bouton-valider-votre-avis.png")">
			<br>
			<textarea id="saisiecommentaire" style="
				background-image: url(@routes.Assets.at("upload/vignerons/vignerons7-medium.jpg"));
				overflow:hidden; height: 50px; padding-top: 0px; padding-bottom: 0px;" 
				onclick="this.value=''"
				name="saisiecommentaire">Ajouter un commentaire...</textarea>
		</form>
		
	</div>
	<div id="nbreavis">22 avis</div>
	@for(rating <- vigneron.getRatings()){
		<div id="note@rating.getType()">
			 @rating.getScore()<br> <span>@rating.getType()</span>
		</div>
	}
</div>
<div style="clear: both;"></div>
}